﻿import { combineReducers } from 'redux';
import * as types from '../const/actionTypes'
import _ from 'lodash'
import * as wepon from '../utils/weapon.js'
import axios from 'axios'

var initialState=[];
function nav(state = initialState, action) {
	switch (action.type) {
		case types.NAV_REQUEST:
			var newData= Object.assign({},state,action.payload);
			newData.loading=true;
			return newData;
		case types.NAV_SUCCESS:
			console.log(action);
			return action.payload.data
		case types.NAV_FAILURE:
			var newData= Object.assign({},state,action.payload);
			newData.loading=false;
			return newData;
		default:
			return state
	}
}
function tableTest(state = initialState, action) {
	switch (action.type) {
		case types.TABLETEST_REQUEST:
			var newData= Object.assign({},state,action.payload);
			newData.loading=true;
			return newData;
		case types.TABLETEST_SUCCESS:
			console.log(action);
			return action.payload
		case types.TABLETEST_FAILURE:
			var newData= Object.assign({},state,action.payload);
			newData.loading=false;
			return newData;
		default:
			return state
	}
}

const reducer = combineReducers({
	nav,
	tableTest
});

export default reducer

